import React from 'react';
import {
  Form,
  Input,
  Button,
  Table,
  Icon,
  Radio,
  InputNumber,
  Checkbox,
  Modal,
  message,
  notification,
  Affix,
  Upload,
  Select,
  Menu,
  Dropdown
} from 'antd';

import InnerTable from 'components/DBTable/InnerTable.js';
import ajax from '../../../utils/ajax';

const FormItem = Form.Item;
const ButtonGroup = Button.Group;
const Option = Select.Option;

var _this;

/**
 * 内部表格组件
 */
class DictionaryManageInnerTable extends InnerTable {

  constructor(props) {
    super(props);
    this.state = {
      ...this.state,
    }
  }

  getButtonGroup = () =>{
    let isButtondisabled=false;
    if(this.state.selectedRowKeys.length > 0){  // 是否选择
      isButtondisabled=true;
    }
    if(this.state.selectedRowKeys.length > 1){  // 是否选择了多项
      isButtondisabled=false;
    }
      let editName="修改";
      let addName="新增";
      let deleteName="删除";    
      let button = [
        <Button key="saveBtn" type="primary" onClick={this.onClickInsert}><Icon type="plus-circle-o" />{addName}</Button>,
        // <Button key='lookBTn' type="primary" onClick={this.onClickView} disabled={!isButtondisabled}><Icon type="info-circle-o" />查看</Button>,
        <Button key="editBtn" onClick={this.onClickUpdate} disabled={!isButtondisabled}><Icon type="edit" />{editName}</Button>,
        <Button key="deleteBtn" onClick={this.onClickDelete} disabled={!isButtondisabled}><Icon type="delete" />{deleteName}</Button>
      ];
      return (<ButtonGroup>
      {/* 注意这里, 如果schema中没有定义主键, 不允许update或delete */}
      {button}
    </ButtonGroup>)
  }
}

export default DictionaryManageInnerTable;
